import { commonTableOptions } from '@/utils/util'

export const tableOption = function () {
  let self = this
  return {
    ...commonTableOptions,
    searchMenuSpan: 8,
    menuWidth: 60,
    column: [
      {
        label: '船企名称',
        search: false,
        prop: 'tenantName',
        hide: false,
        overHidden: true,
        width: 200
      },
      {
        label: '船企名称',
        prop: 'tenantId',
        hide: true,
        search: true,
        filterable: true,
        type: 'select',
        dicData: self.tenantArr,
        change(row) {
          self.getShip(row.value)
        }
      },
      {
        label: '船舶名称',
        prop: 'shipId',
        hide: true,
        search: true,
        filterable: true,
        type: 'select',
        dicData: self.shipArr,
        change(row) {
          console.log('row.value', row.value)
          self.getVideo(row.value)
        }
      },
      {
        label: '船舶名称',
        prop: 'shipName',
        hide: false,
        search: false,
        width: 200,
        overHidden: true
      },
      {
        label: '视频点位',
        width: 100,
        search: true,
        filterable: true,
        prop: 'videoPointsType',
        hide: false,
        overHidden: true,
        type: 'select',
        dicData: self.videoArr,
        props: {
          label: 'lable',
          value: 'value'
        }
      },
      {
        label: '告警等级',
        width: 100,
        search: false,
        prop: 'level',
        hide: false,
        overHidden: true,
        type: 'select',
        dicData: self.levelDic
      },
      {
        label: '告警类型',
        width: 100,
        search: true,
        prop: 'type',
        hide: false,
        overHidden: true,
        type: 'select',
        // dicData: self.$store.getters['dict/getDictByCode']('warning_model'),
        dicData: self.warnModuleArr,
        props: {
          label: 'warningModelName',
          value: 'warningModelCode'
        },
        filterable: true,
        formatter: (row) => {
          return row.type ? self.handleTypeName(row.type) : '--'
        }
      },
      {
        label: '告警图片',
        prop: 'fileThumbAddress',
        width: 200,
        overHidden: false
      },
      {
        label: '告警时间',
        search: true,
        prop: 'createTime',
        hide: false,
        type: 'datetimerange',
        format: 'yyyy-MM-dd HH:mm:ss',
        valueFormat: 'yyyy-MM-dd HH:mm:ss',
        startPlaceholder: '告警开始时间',
        endPlaceholder: '告警结束时间',
        defaultTime: ['00:00:00', '23:59:59'],
        searchRange: true,
        ignoreHide: true,
        searchSpan: 8,
        width: 160,
        editDisplay: false,
        addDisplay: false,
        formatter: (row) => {
          return row.createTime ? row.createTime : '--'
        }
      },
      {
        label: '处理超时',
        prop: 'handleTimeoutFlag',
        hide: false,
        search: false,
        width: 100,
        type: 'select',
        dicData: self.timeDic
      },
      {
        label: '确警时间',
        search: true,
        prop: 'confirmWarningTime',
        hide: false,
        type: 'datetimerange',
        format: 'yyyy-MM-dd HH:mm:ss',
        valueFormat: 'yyyy-MM-dd HH:mm:ss',
        startPlaceholder: '确警开始时间',
        endPlaceholder: '确警结束时间',
        defaultTime: ['00:00:00', '23:59:59'],
        searchRange: true,
        ignoreHide: true,
        searchSpan: 8,
        width: 160,
        editDisplay: false,
        addDisplay: false,
        formatter: (row) => {
          return row.confirmWarningTime ? row.confirmWarningTime : '--'
        }
      },

      {
        label: '通信方式',
        search: false,
        prop: 'pushWay',
        hide: false,
        overHidden: true,
        width: 100,
        type: 'select',
        dicData: [
          { label: '移动网络', value: '1' },
          { label: '卫星', value: '2' }
        ]
      }
    ]
  }
}
